﻿using System;
using System.Web;

using Infrastructure.NetExtensions;

namespace TempEmployees.Web
{
    public class APageData
    {
        public void Remove()
        {
            HttpContext.Current.Session.Remove(this.GetType().ToString());
        }

        public static void Set(APageData data)
        {
            HttpContext.Current.Session[data.GetType().ToString()] = data;
        }

        public static T Get<T>()
        {
            return HttpContext.Current.Session.Get<T>(typeof(T).ToString());
        }

        public static bool Exist<T>()
        {
            return (HttpContext.Current.Session[typeof(T).ToString()] != null);
        }

        public static void Remove<T>()
        {
            HttpContext.Current.Session.Remove(typeof(T).ToString());
        }
    }
}